package io.renren.common.weixin.repleMessage;

import org.springframework.stereotype.Component;

/**
 * @author:mj
 * @Title: 微信回复：图文消息
 * @Package
 * @Description: TODO
 * @date 2018/9/28 0028 下午 2:53
 * @version V1.0
 */
@Component
public class GraphicMessage {

    public String getMessageTemplate(String ToUserName,String FromUserName,long sysdate,String title,String description,String picUrl,String url) {
        String xml = "";
        try {
             xml = "<xml>" +
                    "<ToUserName><![CDATA["+ToUserName+"]]></ToUserName>" +
                    "<FromUserName><![CDATA["+FromUserName+"]]></FromUserName>" +
                    "<CreateTime>"+sysdate+"</CreateTime>" +
                    "<MsgType><![CDATA[news]]></MsgType>" +
                    "<ArticleCount>1</ArticleCount>" +
                    "<Articles><item>" +
                    "<Title><![CDATA["+title+"]]></Title>" +
                    "<Description><![CDATA["+description+"]]></Description>" +
                    "<PicUrl><![CDATA["+picUrl+"]]></PicUrl>" +
                    "<Url><![CDATA["+url+"]]></Url>" +
                    "</item></Articles>" +
                    "</xml>";
        } catch (Exception e) {
            // 获取token失败
            e.printStackTrace();
            xml = "";
        }
        return xml;
    }

}
